/*
 * @Author: szx
 * @Date: 2022-05-26 13:37:16
 * @LastEditTime: 2022-05-26 13:50:15
 * @Description:
 * @FilePath: \leetcode\面试题\10\05\05.js
 */
/**
 * @param {string[]} words
 * @param {string} s
 * @return {number}
 */
var findString = function (words, s) {
    return words.indexOf(s);
};

var findString = function (words, s) {
    let l = 0,
        r = words.length - 1;
    while (l <= r) {
        let mid = (l + r) >> 1;
        if (l < mid && s != '') mid--;
        if (s === words[mid]) return mid;
        else if (s < words[mid]) r = mid - 1;
        else l = mid + 1;
    }
    return -1;
};
